My question is maybe silly but I have a text_field_tag define like this
in my code:
%= text_field_tag(repcarte, @reperecarte ,:class = input
colonnetab)%
Using this I thought that when in my application I will size some text
in the text_field then my variable @reperecarte will contain the sized
What is missing is that you still have not understood some of the
basics of rails, and the answer is to do what I have suggested on
several occasions which is to work right through a good tutorial such
as railstutorial.org (including doing all the exercises).
Colin
I think that your answer is a
I have in my view a select td%= select :nomdefaut, @mydefaut,
@ndefaut%/td
I see the different values of @ndefaut but then but then @mydefaut is
supposed to contain the selected value in the list but when I display
@mydefaut in the view my text field is blank.
I see that we can use
mike2r wrote in post #1147137:
. Any
instance variables that are referenced in the view must be defined
within
that action.
All my variables used in my view are defined in my controller in a
methode inivariable and then I use before_filter :inivariable then they
are initialized.
Even the
Colin Law wrote in post #1146856:
On 23 May 2014 07:41, Fab Forestier li...@ruby-forum.com wrote:
id_op2 name_op2num_op2button
Be careful operation is not a model in this view but a variable. I don't
know how to assign my variable in fonction of the button line
mike2r wrote in post #1146701:
On Wednesday, May 21, 2014 7:42:39 AM UTC-4, Ruby-Forum.com User wrote:
format.json { head :no_content }
respond_to do |format|
--
Posted via http://www.ruby-forum.com/.
The problem is the redirect. When you do a redirect, Rails actually
Walter Davis wrote in post #1147109:
On May 26, 2014, at 4:28 AM, Fab Forestier wrote:
htttp://localhost:3000/operations/some_action?value=73. You can
easily do this with something like link_to(label,
:controller=operations, :action=some_action, :value=73). Then in
the action
Scott Ribe wrote in post #1147132:
On May 26, 2014, at 8:00 AM, Fab Forestier li...@ruby-forum.com wrote:
But the in the methode ajouter how can I have something like
@myvariable=n or @myvariable=@defautrec[i] where I is the current line
of the table?
%= link_to controller: pages, action
Yes you're both right.
My problem is not to redirect or to render and not to config routes.
My problem is the assignment of the variable @operation, how can I
assign the operation which correspond to the right button?
Operations
--
Sorry th etitle of the topic isn't very clear but it's difficult to
summarize my problem!
I made a view without model but I display in table the content of a
variable named '@operations'. So each line corresponds to an operation.
In my table I have also a column with a button for each line. When
Colin Law wrote in post #1146780:
The first
question is whether you need to use a form, do you need to post data,
or is each button effectively just a link?
Colin
No this table just allow users to show the differents existing
operations and the if they want to modify it they have to click
Colin Law wrote in post #1146785:
I think so. You can use button_to do invoke the action, and pass the
operation number as a parameter or in the url. If you look at the
docs for button_to and google it to find more examples you will surely
find examples that meet your needs.
Colin
My
Colin Law wrote in post #1146799:
Just set the action on each button to the url that you want invoked,
so something like edit_article_path( article_ id ) where article_id is
the id of the article on that row.
Get it working just using link_to first, then make the link look like
a button if
Colin Law wrote in post #1146811:
On 22 May 2014 16:00, Fab Forestier li...@ruby-forum.com wrote:
You said that, for example, the link should take you to the edit page
of an article. How does the user know what article that is?
Colin
No by exemple I understand the action of the button
Colin Law wrote in post #1146617:
So your problem is not creating a view without a model, it is invoking
an action from a view. It is no good just saying that you can't call
the action, what error are you getting? It does not look to me as if
that line is valid, look at the parentheses.
Hi everybody, in my view (operation_en_cours) I display the content of a
variable (myvariable) and I have a button linked to a method ( for
exemple change)defined in my controller in which I change the content of
my varible like this:
@myvariable=hello
def change
@myvariable=test
Ronald Fischer wrote in post #1146690:
Rails 4.1.1, Ruby 2.1.1, OSX 10.6
This works:
rails generate model Word repr:string level:integer atari:integer
triple:references
This does not:
rails generate model -p Word repr:string level:integer atari:integer
triple:references
It raises the
mike2r wrote in post #1146701:
The only way to do what you want is to use a render instead of a
redirect.
Thank you very much for you answer and your explanation, I'm in business
using:
def ajouter
@reperecarte[0]=test
respond_to do |format|
format.html { render :template
Hassan Schroeder wrote in post #1146499:
Indeed they show how to fetch data from the database but I have only
seen exemples with scaffold's views, I mean _form, new, index...
Seriously? On this page that Colin referenced:
http://guides.rubyonrails.org/active_record_querying.html
where do
I have looked more preciselly what does he do in railstutorial.org but
even login/logout chapter doesn't help me. Indeed he use resources in
he's routes. Then he rename new, destroy... path's in '/login' '/logout'
but in my case I can't do the same thing...
I have no more ideas, and I have
Colin Law wrote in post #1146600:
I don't think anyone knows what it is that you do not know how to do.
I think it is something to do with routing but am not sure. Please
describe just the bit you have a problem with, not the whole
requirement.
Colin
I will have difficults to discribe a
Colin Law wrote in post #1146603:
But as you said yourself the tutorial does create a view without a
model. It is easy. All you have to do is make a controller file
controllers/somename_controller.rb, put the desired actions in it,
create view files such as views/somename/theaction.html.erb
Colin Law wrote in post #1146291:
I can assure you that railstutorial.org most certainly shows you how
to fetch data from the database. I have also pointed you at the Rails
Guides and you said you had looked at them. Have another look at the
one on ActiveRecord Query Interface for different
On 16 May 2014 14:54, Walter Lee Davis wa...@wdstudio.com wrote:
controller then just create one specifically for searches. However,
That is down to how you structure your form tag in that view. This can be as
simple as a hand-coded form (no need for form_for helper here) and
whatever you
Finaly I find this tutorial to solve my problem:
http://www.stefanosioannou.com/rails-4-simple-search-form/
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To unsubscribe from this group and
Is it possible to define a methode for a search bar in my layout which
will search for an article for exemple and then show the article
redirecting to the edit view ?
Thanks for your help!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the
Colin Law wrote in post #1146255:
On 16 May 2014 09:48, Fab Fab li...@ruby-forum.com wrote:
after this if i use resources:currentoperations in routes.rb that will
create the routes for new, index _form views but i don't want them.
Have a look at the Rails Guide on Routing, that will show you
My specific question is where can I define the methode for the layout
because he hasn't a controller?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To unsubscribe from this group and stop
try something like this:
%= link_to t('.new', :default = t(helpers.links.new)),
new_article_path(article), :class = 'btn
btn-mini' %
Where class ='btn btn-mini' is un type of button when you use bootstrap
theme if you don't use it try whitout this option.
--
Posted via
Colin Law wrote in post #1146271:
If you worked through railstutorial then you cannot have been paying
much attention, as the demo app starts with exactly what you are
asking for [1]. As I said, I suggest you work right through that
tutorial (not just skim through it) that will help you to
Please quote the previous message in your reply so that it easier to
follow the thread. Note that this is a mailing list not a forum
(though you may be accessing via a forum-like interface).
Sorry I will pay attention new time!
If the search actions do not fit well with one of the existing
31 matches
Mail list logo