I'm writing a Rails plugin, and need to be able to dynamically determine which model a controller is associated with. For example, if I have a PeopleController, I need a clean way to determine that the controller handles Person models.
I've had a look through the API and haven't found a method for it.
Is the only way to do this as a re...
How does one delete a user from the system in ASP.NET MVC? Is there any facility built in that I'm just not seeing?
I have a Customers controller which ties into the default Account controller well for the most part but when it comes to deleting them, deleting from the Customers table isn't enough as the user name is now effectively "r...
I have a portion of my app that sometimes will need to inform the user of their action, but the app does not know of the requirement to inform the user until after the form has been submitted (which eliminates Javascript).
Basically what happens is that the user uploads one or more files containing records, if the number of records with...
Hi,
I been building my first ASP.NET MVC application and so far am getting to grips quite well with it I think. Some of the concepts are still fuzzy (routing) but I have an idea.
One of the things we do with our WebForms apps is to route navigation through an Application Controller [Fowler] to handle our page navigation based on the cu...
I have a table in my view controller (let's call it TVC1). I have rows in TVC1 that are used so the user can input some more data in addition to the data on TVC1. So, when someone taps a specific row in TVC1, it will show another view controller (let's call it TVC2). However, when TVC2 is shown, all of the data in TVC1 is cleared. How ca...
I have created a site which utilizes subdomains and searches whether or not the user is at: subdomain.domain.com or domain.com. If the user is in subdomain.domain.com, /views/layouts/application.html.erb appears, if the user is in domain.com /views/layouts/promo_site.html.erb appears. To accomplish this I closely followed Robby on Rails ...
Hi
My Application have navigation controller and table views. When the back button is clicked and the view is popped out from controller stack, i noticed that the table events are not executed (eg: cellForRowIndexPath). Is there anyway that these events are execueted when view is popped out.
This is the code i use for pushing the view...
I have the following code in a controller
user = RegUser.create_reg_user(:some_parameters)
UserStuff.pass_user(some_parameters)
@hex = user.hex
The @hex is passed to the view and returned. The UserStuff call is taking a decent amount of time and is not actually important to the @hex which is needed for the view. Is there a way to go...
Hi all,
Does QEMU provide emulation for any target with USB device controller? Actually I am developing an embedded linux based device and was thinking about testing it on QEMU.
BR,
Mooni
...
My question concerns how I can use one comments controller with multiple 'belongs to' controllers.
I want to add comments to news, posts, and matches (it's a tennis website). I've got the comments add action setup to use the 'ajax' helper and I'm also using counterCache to keep track of the number of comments for each news, post and mat...
I have 3 views in my app. Main view has 2 buttons and when selected it displays 2nd view(which again has buttons and displays a 3rd view with images). I have a home button on second view. When pressed I want to show the main view. I can do this if I add the 2nd view as subview
[self.view addSubview:secondViewController.view]
But whenev...
The mechanics of making this work aren't hard, but testing it is a little strange. The scenario is that I want to dump some basic user data into the view data based on the User property of a base controller (an IPrincipal object) so that the master page always has it. I need access to my IUserManager (a service class), which is provided ...
Hi,
I'm slightly insecure about my breadcrumb solution. Names and links are defined in each controller action:
<a href="http://localhost:3000/">Home</a>
<% if defined? @l1_link %>
> <a href="<%= @l1_link%>"><%= @l1_name %></a>
<% if defined? @l2_link %>
> <a href="<%= @l2_link%>"><%= @l2_name %></a>
<% end %>
<% end ...
http://localhost/frontend_dev.php/1
Why is the above request redirected to frontend_dev.php instead of index.php?
I've read the .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
# we skip all files with .something
...
I'm tempted to say yes.
A contrived example, using has_many :through and polymorphs:
class Person < ActiveRecord::Base
has_many :clubs, :through => :memberships
has_many :gyms, :through => :memberships
end
class Membership < ActiveRecord::Base
belongs_to :member, :polymorphic => true
end
class Club < ActiveRecord::Base
has_ma...
I'm working on a controller that is a part of a very flat hierarchy of pages, and it looks like one section of the site could have over a dozen action methods, not including their corresponding post actions. Is there a good way to break this controller up while still preserving the section name? I don't want that controller class getti...
I've been trying to use the code here:
http://snafu.diarrhea.ch/blog/article/4-serving-static-content-with-rails
but I'm getting errors like:
undefined method `template_exists?' for #<StaticController:0xb74cbe4c>
How can I update this method to Rails 2.5? Probably there are other deprecated things too.
...
I want to use _forward() in preDispatch after checking if the user is logged in in every controller.
The scenario is quite easy: If the user is not logged in, it should be forwarded to loginAction either in the same controller or in another controller.
This would cause an infinite loop, as the dispatch process starts over again, callin...
I've got two models:
class Solution < ActiveRecord::Base
belongs_to :user
validates_attachment_presence :software
validates_presence_of :price, :language, :title
validates_uniqueness_of :software_file_name, :scope => :user_id
has_attached_file :software
end
class User < ActiveRecord::Base
acts_as_authentic
validates_pr...
I've created an Audit table for an ASP.NET MVC application to track key changes and actions. I want to present the contents of this table to authorized users in an easily readable format on the view.
The Audit table is (simplified) like so:
ID (int) | StaffID (int) | Action (string) | Timestamp (datetime)
------------------------------...